Personal tools

Lua/Shared/table/count

From JC2-MP Documentation

< Lua‎ | Shared
Jump to: navigation, search

Returns    number
Prototype    table.count(table table)
Description    Returns the number of entries in (table). Unlike the # operator, this counts non-sequential/numeric indexes.


Examples

local t = {"one", "two"}
table.insert(t, "three")
t.apple = "four"
print(#t) -- 3
print(table.count(t)) -- 4